import request from '@/utils/request'

// 请求角色列表
export function getRoles(data) {
  return request.get('/api/sys/role', { params: data })
}

export function delRoles(id) {
  return request.delete(`/api/sys/role/${id}`)
}

export function addRole(data) {
  return request.post('/api/sys/role', data)
}

export function editRole(data) {
  return request.put('/api/sys/role/' + data.id, data)
}

// 获取角色详情
export function getRoleDetail(id) {
  return request({
    url: `/api/sys/role/${id}`
  })
}

// 给角色分配权限
export function assignPerm(data) {
  return request({
    url: '/api/sys/role/assignPrem',
    method: 'put',
    data
  })
}
